---
layout: "default"
title: "CustomStringConvertible"
description: "Swift documentation for 'CustomStringConvertible': A type with a customized textual representation."
keywords: "CustomStringConvertible,protocol,swift,documentation,description"
root: "/v2.0"
---

<div class="intro-declaration"><code class="language-swift">protocol CustomStringConvertible</code></div>

<div class="discussion comment">
    <p>A type with a customized textual representation.</p>

<p>This textual representation is used when values are written to an
<em>output stream</em>, for example, by <code>print</code>.</p>

<p><strong>Note:</strong> <code>String(instance)</code> will work for an <code>instance</code> of <em>any</em>
  type, returning its <code>description</code> if the <code>instance</code> happens to be
  <code>CustomStringConvertible</code>.  Using <code>CustomStringConvertible</code> as a
  generic constraint, or accessing a conforming type&#39;s <code>description</code>
  directly, is therefore discouraged.</p>

<p><strong>See Also:</strong> <code>String.init&lt;T&gt;(T)</code>, <code>CustomDebugStringConvertible</code></p>
</div>

<table class="standard">
<tr>
<th id="inheritance">Inheritance</th>
<td>
<span class="viz"><a href="hierarchy/">View Protocol Hierarchy &rarr;</a></span>
</td>
</tr>



<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>




<h3>Instance Variables</h3>
<div class="declaration" id="var-description_-string">
<a class="toggle-link" data-toggle="collapse" href="#comment-var-description_-string">var description: String</a> <span class="required">Required</span><div class="comment collapse" id="comment-var-description_-string"><div class="p">
    <p>A textual representation of <code>self</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">var description: String { get }</code>

    </div></div>
</div>





